<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // console.log(isNaN("aa"));//true
        // console.log(parseInt(78.987));//78
        function calc(a,b){
            var sum=a+b;
           
            return sum;//使用return来返回函数的运行结果
        }

        var res=calc(10,20);
        console.log(res);

        // console.log(calc(1000,2000));
        

        // 如果return后面没有跟返回值或者没有使用return关键字，则默认值为undefined
        function calc2(a,b){
            var sum=a+b;
            return sum;
        }
        var res=calc2(10,20);
        console.log(res/2);

       /*  
        return关键字的作用：
            1.返回函数的执行结果
            2.结束函数的执行 
        */
       function calc3(x,y){
            console.log(x-y);
            return 60;//结束函数的执行
            console.log("哈哈哈");
       }
       //calc3(100,20);
       console.log(calc3(100,20));

       console.log("-------------");

       function calc4(){
            return 10;
            console.log("嘻嘻嘻");
       }
       console.log(calc4());

       console.log("*****");
       
       function calc5(a,b){
            console.log(a+b);
            return b;
       }
       console.log(calc5(100,29));
       console.log("%%%%%%%%%%%%%%%%%%%%%%");
       function show(a,b,c){
            return a+b-c;
            console.log("嘿嘿");
            console.log("哈哈");
       }

       console.log(show(30,40,10));

       
    </script>
   
</head>
<body>
    
</body>
</html>